package com.skyinno.mrms.utils;

import java.io.IOException;
import java.text.SimpleDateFormat;

import javax.annotation.PostConstruct;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class Constants implements ApplicationContextAware {
    private ApplicationContext ac;

    public void setApplicationContext(ApplicationContext arg0)
            throws BeansException {
        this.ac = arg0;
    }

    public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(
            "yyyy-MM-dd");

    public static final SimpleDateFormat DATE_TIME_FORMAT = new SimpleDateFormat(
            "yyyy-MM-dd HH:mm:ss");

    @PostConstruct
    private void setFilePath() throws IOException {
        REAL_PATH = ac.getResource("/").getFile().getAbsolutePath();
    }

    public static final String SCHEMA = "mrms_dev";

    public static final String ERROR_VIEW_NAME = "/error";

    public static final String PAGE_DATE_ATTRIBUTE = "page";

    public static final String SOS_DATA_DC = "dc";

    public static final String SOS_DATA_CC = "cc";

    public static final String MENU_ROOT = "0000000000";

    public static final String VALID = "1";

    public static final String INVALID = "0";

    public static final String RESULT_SUCCESS = "通过";// 审批通过

    public static final String RESULT_ERROR = "退回";// 审批退回

    public static final String DELETE = "2";

    public static String FILE_PATH = "/file/";

    public static String TEMP_FILE_PATH = FILE_PATH + "temp/";

    public static String REAL_PATH;

    public static final String YES = "1";

    public static final String NO = "0";

    public static final String LOGIN_USER = "LOGIN_USER";

    public static final String SEPARATOR = "-";

    public static final String NODE_TYPE_PERMISSION = "P";

    public static final String NODE_TYPE_MENU = "M";

    public static final String NODE_TYPE_MENU_ROOT = "R";

    public static final String NODE_TYPE_OPERATE = "O";

    public static final String CASE_NODE = "1";

    public static final String MANAGE_NODE = "2";

    public static final String MENU_TYPE_SAME = "1";

    public static final String INPUT_ITEM_ROOT = "0000000000"; // 输入类型根目录

    public static final String INPUT_ITEM_TYPE_AUTHENTICATION = "100"; // 赛事认证等级

    // 字典类型

    /** 分组性别 */
    public static final String DICT_EVENT_GROUPSEX = "100";

    /** 赛事状态 */
    public static final String DICT_EVENT_STATUS = "101";

    /** 赛事进程 */
    public static final String DICT_EVENT_PROCESS = "102";

    /** 举办形式 */
    public static final String DICT_HOLD_FORM = "103";

    /** 团体报名 */
    public static final String DICT_GROUP_REGISTRATION = "104";

    /** 成绩对比 */
    public static final String DICT_RESULT_CONTRAST = "105";

    /** 赞助商类型 */
    public static final String DICT_SPONSORMAINTENANCE_TYPE = "112";

    /** 年龄组别 */
    public static final String DICT_AGEGROUP_TYPE = "132";

    public static final String DICT_RESULT_CTFTYPE = "109";

    public static final String NICKNAME_PREFIX = "TY";// 昵称默认前缀

    public static final String CHINA = "44";// 国内ID

    public static final String WXNO_TYPE_SUBSCRIBE = "1";

    public static final String WXNO_TYPE_SERVICE = "2";

    public static final String IMG_DOC = "006";

    public static final String ENCODE = "utf-8";

    /**
     * 身份证ID
     */
    public static final String ID_CARD = "4028813b5186303f01518630e1870100";

    /**
     * 护照ID
     */
    public static final String ID_PASSPORT = "4028813b5186303f01518630e1870111";

    /**
     * 回乡证ID
     */
    public static final String ID_HVPS = "4028813b5186303f01518630e1870113";

    /**
     * 台胞证ID
     */
    public static final String ID_MTP = "4028813b5186303f01518630e1870114";
    
    /**
     * 证件类型
     * 其他
     */
    public static final String ID_OTHER = "4028813b5186303f01518630e1870112";

    public static final String LOGISTIC_ID = "4028813b5186303f01518630e1870911";// 物流ID

    public static final String COLLECTION_TIME = "4028813b5186303f01518630e1870910";// 现场领取ID

    public static final String BLOODTYPE = "107";// 数据字典对应血型类型

    public static final String OCCUPATION_TYPE = "108";// 职业类型

    public static final String CERTIFICATE_TYPE = "109";// 证件类型

    public static final String CLOTHSIZE_TYPE = "110";// 服装尺寸类型

    public static final String RECEIVING_TYPE = "111";// 物资领取类型

    public static final String OTHER_NATION_TYPE = "57";// 民族其他

    public static final String OPERATOR_TYPE = "113";// 运营商类型

    public static final String ENTRY_FORM_FREE_TYPE = "114"; // 免费报名类型

    public static final String SEX_TYPE = "118"; // 性别类型

    public static final String MATERIAL_TYPE = "130"; // 物資类型

    public static final String MANUFACTURER = "131"; // 生产厂家、品牌

    public static final String HISTORY_EVENT_TYPE = "123"; // 历史赛事类型
    
    public static final String EVENT_TYPE = "119"; // 项目类型

    public static final String PERMISSION_DATA = "D";

    public static final String PERMISSION_NODE = "N";

    public static final String NODE_TYPE_MENU_CHILDREN = "C";

    public static final String HISTORYEVENT_TYPE = "123";// 历史赛事类型

    public static final int HISTORYEVENT_YEAR = 2;// 历史赛事年份下拉

    public static enum TEMPLATE {
        T1("1", "1.png"), T2("2", "2.png");
        public final String id;

        public final String image;

        private TEMPLATE(final String id, final String image) {
            this.id = id;
            this.image = image;
        }
    }

    public static enum DETIAL_TEMPLATE {
        T1("1", "2.png");

        public final String id;

        public final String image;

        private DETIAL_TEMPLATE(final String id, final String image) {
            this.id = id;
            this.image = image;
        }
    }

    public static final String APPROVAL_WAIT = "3";

    public static final String APPROVAL_PASS = "1";

    public static final String APPROVAL_CANCEL = "0";

    public static final String RELATIVE_FILE_URL = "file.dl?id=";

    public static final String MENU_IMG_DOC = "0000000022";

    public static final String REPLY_MATERIAL_TEXT = "1";

    public static final String REPLY_MATERIAL_IMG_DOC = "2";

    /**
     * 性别--男
     */
    public static final String SEXM_ID = "402881165501b23d015501b36a530055";

    /**
     * 性别--女
     */
    public static final String SEXF_ID = "402881165501ba10015501bb2cb20066";

    public static final String QUESTIONNAIRE_TYPE_EXPANSION = "E";

    public static final String QUESTIONNAIRE_TYPE_DISTRIBUTED = "D";

    /**
     * 变量的key(国家-中国)
     */
    public static final String COUNTRY_CHINA_ID_KEY = "country.china";

    public static final String QUESTIONNAIRE_SUBJECT_TYPE_SINGLESELECT = "S";

    public static final String QUESTIONNAIRE_SUBJECT_TYPE_MULTISELECT = "M";

    public static final String QUESTIONNAIRE_SUBJECT_TYPE_ANSWER = "A";

    public static final Integer MATCH_SCORE_300 = 3600 * 3;

    public static final Integer MATCH_SCORE_400 = 3600 * 4;

    public static final Integer MATCH_SCORE_450 = 360 * 45;

    /**
     * 男-项目性别
     */
    public static final String PROJECT_SEX_M = "402881165501b23d015501b36a530000";

    /**
     * 女-项目性别
     */
    public static final String PROJECT_SEX_F = "402881165501ba10015501bb2cb20003";

    /**
     * 混合-项目性别
     */
    public static final String PROJECT_SEX_BLEND = "402881165501ba10015501bb45150004";

    /** ****************************************************赛事类型******************************************************* */
    /**
     * 5公里
     */
    public static final String EVENT_TYPE_5_KM = "4028811a555c578f01555ce699e00013";

    /**
     * 10公里
     */
    public static final String EVENT_TYPE_10_KM = "4028811a555c578f01555ce65ed40012";

    /**
     * 全程
     */
    public static final String EVENT_TYPE_FULL = "4028811a555c578f01555ce5bef10010";

    /**
     * 半程
     */
    public static final String EVENT_TYLPE_HALF = "4028811a555c578f01555ce61fd40011";

    public static final String DATA_YES = "Y";

    public static final String DATA_NO = "N";

    /**
     * 举办形式-线下形式
     */
    public static final String HOLDFORM_ENTRY_FORM_ID = "40288116550adea501550ae172260001";

    /**
     * 允许
     */
    public static final String ALLOW_ID = "40288116550adea501550ae6a3260007";

    /**
     * 领导审批
     */
    public static final String LA_ID = "402881f555a96e2c0155a98aa3360010";

    /**
     * 财务审批
     */
    public static final String FA_ID = "402881f555a96e2c0155a98b1e010011";

    /**
     * 总经理审批
     */
    public static final String MA_ID = "402881f555a96e2c0155a98b57630012";

    /**
     * 项目类型 commonDict type
     */
    public static final String PROJECT_TYPE = "119";

    /**
     * 快递公司类型
     */
    public static final String EXPRESS_TYPE = "121";

    public static final String EVENT_PORT_TYPE_SIDE = "S";

    public static final String EVENT_PORT_TYPE_CORNER = "C";

    public static final String EVENT_PORT_TYPE_HOST = "H";

    public static final String EVENT_PORT_TYPE_UNDERTAKE = "U";

    public static final String[] IS_NO = { "是", "否" };

    /**
     * 历史赛事类型(全程/半程)
     */
    public static final String HISTORY_EVENT_TYPE_ALL_ID = "commonDict.history.event.type.all.id";

    public static final String EVENT_PORT_TYPE_CO = "O";

    public static final String INPUT_TYPE_TEXT = "text";

    public static final String INPUT_TYPE_TEXTAREA = "textarea";

    public static final String INPUT_TYPE_CHECKBOX = "checkbox";

    public static final String INPUT_TYPE_RADIO = "radio";

    public static final String INPUT_TYPE_SELECT = "select";

    public static final String INPUT_TYPE_DATE = "date";

    public static final String INPUT_LIMIT_COMMON = "1";

    public static final String INPUT_LIMIT_ALPHANUMERIC_CHARACTERS = "2";

    public static final String INPUT_LIMIT_ENGLISH_CASE = "3";

    public static final String INPUT_LIMIT_ZERO_POSITIVE_INTEGER = "4";

    public static final String INPUT_LIMIT_POSITIVE_INTEGER = "5";

    public static final String INPUT_LIMIT_DECIMAL = "6";

    public static final String INPUT_LIMIT_MAILBOX = "7";

    public static final String INPUT_LIMIT_PHONE = "8";

    public static final String INFO_TYPE_NAME = "01";

    public static final String INFO_TYPE_PHONE = "02";

    public static final String POST_EVENT = "004";

    public static final String BEHAVIOR_ADD = "01";

    public static final String BEHAVIOR_READ = "02";

    public static final String EVENT_PORT_TYPE_OPERATION_INSTITUTION = "I";

    public static final int YES_INT = 1;

    public static final int NO_INT = 0;

    public static final String DICT_COLOUR = "115";

    public static final String DICT_LABEL = "116";

    public static final int SCHEDULE_YES = 0;

    public static final int SCHEDULE_NO = 1;

    public static final String DICT_TYPE = "117";

    public static final int GOODS_ORDER_TOBEPAID = 0;

    public static final int GOODS_ORDER_TOBESHIPPED = 1;

    public static final int GOODS_ORDER_SHIPPED = 2;

    public static final int GOODS_ORDER_RECEIVED = 3;

    public static final int ROOM_ORDER_RESERVE = 0;

    public static final int ROOM_ORDER_PAID = 1;

    public static final int ROOM_ORDER_SCHEDULED = 2;

    public static final int GOODS_ORDER_CANCEL = 4;

    public static final int ROOM_ORDER_CANCEL = 4;
    
    /**
     * 求助任务中心
     */ 
    public static final String TASK_STATUS_1 = "0";//未处理
    public static final String TASK_STATUS_2 = "1";//处理中
    public static final String TASK_STATUS_3 = "2";//已处理
    
    public static final String HELP_STATUS_1 = "0";//已求助
    public static final String HELP_STATUS_2 = "1";//已处理
    public static final String HELP_STATUS_3 = "2";//已撤销
    
    public static final String HELP_TYPE_1 = "1";//1安保任务
    public static final String HELP_TYPE_2 = "2";//2补给任务
    public static final String HELP_TYPE_3 = "3";//3医疗任务
    
    public static final String PUSH_TYPE_1 = "1";//安保任务
    public static final String PUSH_TYPE_2 = "2";//补给任务
    public static final String PUSH_TYPE_3 = "3";//医疗任务
    public static final String PUSH_TYPE_4 = "5";//请求任务后台审核通过
    public static final String PUSH_TYPE_5 = "6";//请求任务审核不通过
    
    
    //友盟-安卓	运营版	appkey
    public static final String APP_KEY_AND_OPE = "5808a38f8f4a9d1900000b0f";
    
    //友盟-安卓	运营版	appMasterSecret
    public static final String APP_MS_AND_OPE = "wfyp0c6k4tbqly84lmdlo1sfnhe1zfjm";
    
    //友盟-iOS	运营版	appkey
    public static final String APP_KEY_IOS_OPE = "580acad6f43e487565002065";
    
    //友盟-iOS	运营版	appMasterSecret
    public static final String APP_MS_IOS_OPE = "vuy7mxijtqwvsomey8rlrcv6slpd50zn";
    
    public static final String APP_KEY_AND = "580acbe4c62dca41d80010fc";

    // 友盟-安卓 用户版 appMasterSecret
    public static final String APP_MS_AND = "3fvxzjq5pnpt1njigr8erl6yo5swy8a9";

    // 友盟-iOS 用户版 appkey
    public static final String APP_KEY_IOS = "580acb5e07fe6545220019c7";

    // 友盟-iOS 用户版 appMasterSecret
    public static final String APP_MS_IOS = "q6brw240l0shxbgrx5oh42euuhimkwep";

    public static final String DICT_HOTEL_TYPE = "120";

    public static final int ROOM_ORDER_FINISH = 3;

    public static final int ORDER_TYPE_HOTEL = 0;

    public static final int ORDER_TYPE_GOODS = 1;

    public static final int MSG_TPL_GOODS_DELIVER = 0;

    public static final int MSG_TPL_GOODS_CANCEL = 1;

    public static final int MSG_TPL_HOTEL_RESERVE = 2;

    public static final int MSG_TPL_HOTEL_CANCEL = 3;

    public static final int SERVICE_ORDER_RESERVED = 0;

    public static final int SERVICE_ORDER_CONFIRMED = 1;

    public static final int SERVICE_ORDER_CANCELED = 2;

    public static final int ORDER_TYPE_SERVICE = 2;

    public static final int ORDER_BACKSTAGE_CANCEL = 1;
    
    public static final String INPUT_LIMIT_ID = "9";
    
    //志愿者账户类型
    public static final String VOLUNTEER_ACCOUNT = "0";		//志愿者
    
    public static final String SYS_USER_ACCOUNT = "1";		//主办方
    
    //志愿者坐标超时校验
    public static final String REDIS_VOLUNTEER_COORDINATE_TIMEOUT = "vTimeout.";
    
    //志愿者历史坐标
    public static final String REDIS_VOLUNTEER_COORDINATE = "vCoordinate.";
    
    public static final String REDIS_PLAYER_ACHIEVEMENT = "pAchievement.";   //参赛者成绩
    
    public static final String REDIS_PLAYER_COORDINATE = "pCoordinate.";  //参赛者坐标
    
    
    //redis前缀
    public static String REDIS_PLAYER_MESSAGE = "pMessage.";   //参赛者基本信息
	
	public static String REDIS_VOLUNTEER_MESSAGE = "vMessage.";   //志愿者基本信息
	
	public static String REDIS_SYS_USER_MESSAGE = "sMessage."; //主办方基本信息
	
	//志愿者类型
    public static final String VOLUNTEER_TYPE_SECURITY = "SECURITY";  //安保志愿者
    public static final String VOLUNTEER_TYPE_SUPPLY = "SUPPLY";     //补给志愿者
    public static final String VOLUNTEER_TYPE_MEDICAL = "MEDICAL";   //医疗志愿者
    public static final String VOLUNTEER_TYPE_OTHER = "OTHER";    //其它志愿者
    
    //用户类型
    public static final String USER_TYPE_PLAYER = "0";  //参赛者
    public static final String USER_TYPE_VOLUNTEER_SECURITY = "1";  //安保志愿者
    public static final String USER_TYPE_VOLUNTEER_SUPPLY = "2";   //补给志愿者
    public static final String USER_TYPE_VOLUNTEER_MEDICAL = "3";  //医疗志愿者
    public static final String USER_TYPE_SYSUSER = "4";           //主办方
    public static final String USER_TYPE_VOLUNTEER_OTHER= "5";    //其它志愿者
    
    //场景类型
    public static final String ACTION_TYPE_SHOW_MAP = "0";  //地图展示
    public static final String ACTION_TYPE_MEDICAL_TASK = "1";  //医疗任务推送

}
